import Http from '@/utils/http';

export const getSubuser = () => {
  return Http.get({
    url: '/yp_admin/getSubuser',
  })
    .then((res) => {
      return res.data.list;
    })
    .catch((error) => {
      console.error('Failed to fetch subuser:', error);
      throw error; // 重新抛出错误，让调用者可以处理
    });
};

export const getExamApplications = (user_id, page = 1, pageSize = 1000) => {
  return Http.post({
    url: '/yp_admin/getExamApplications',
    data: {
      user_id,
      page,
      pageSize,
    },
  })
    .then((res) => {
      return res.data;
    })
    .catch((error) => {
      throw error; // 重新抛出错误，让调用者可以处理
    });
};
